<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Comments extends Model
{
    use HasFactory,SoftDeletes;
    protected $guarded=['order_id'];
    protected $dateFormat='U';

    protected function serializeDate(\DateTimeInterface $date)
    {
        return $date->format('Y-m-d H:i:s');
    }

    public function product()
    {
        return $this->hasOne(Products::class,'id','products_id');
    }

    public function user()
    {
        return $this->belongsTo(Users::class,'users_id','id');
    }

    public function users()
    {
        return $this->hasOne(Users::class);
    }

}
